﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VoiceTestPlatform
{
    /// <summary>
    /// 结果记录
    /// </summary>
    public class TestResult : NotifyObject
    {
        public Result Result { get; set; }

        /// <summary>
        /// 结果时闭
        /// </summary>
        public string TestDate { get; set; }

        /// <summary>
        /// 结果文字
        /// </summary>
        public string ResultText
        {
            get
            {
                switch (Result)
                {
                    case Result.None:
                        return "无";
                    case Result.Success:
                        return "成功";
                    case Result.Fail:
                        return "失败";
                    case Result.Timeout:
                        return "超时";
                    default:
                        return "无";
                }
            }
        }

        /// <summary>
        /// 音频
        /// </summary>
        public string Audio { get; set; }

        /// <summary>
        /// 音频命令
        /// </summary>
        public string AudioCommand { get; set; }

        /// <summary>
        /// 识别到的命令
        /// </summary>
        public string Recognition { get; set; }


        public string DistanceText { get; set; }
        public string AngelText { get; set; }
        public string NoiseText { get; set; }

        /// <summary>
        /// 声音播放完成时
        /// </summary>
        public DateTime? PlayCpt { get; set; }

        /// <summary>
        /// 识别到时
        /// </summary>
        public DateTime? RecognitionTime { get; set; }

        /// <summary>
        /// 相关背景录音
        /// </summary>
        private string backSound;

        public string BackSound
        {
            get { return backSound; }
            set { backSound = value; }
        }

       // public String BackSound { get; set; }

        public string RecognitionTimeString
        {
            get
            {
                if (PlayCpt.HasValue && RecognitionTime.HasValue)
                {
                    return (RecognitionTime.Value - PlayCpt.Value).TotalSeconds.ToString(); 
                }
                return string.Empty;
            }
        }

        public string AudioArea { get; set; }//地域
        public string AudioSex { get; set; }//性别
        public string AudioNo { get; set; }//编号

        public void NotifyProperty(string pname)
        {
            this.RaisePropertyChanged(pname);
        }
    }


    public enum Result
    {
        /// <summary>
        /// 无
        /// </summary>
        None = 0,
        /// <summary>
        /// 成功
        /// </summary>
        Success = 1,
        /// <summary>
        /// 失败
        /// </summary>
        Fail = 2,
        /// <summary>
        /// 超时
        /// </summary>
        Timeout = 3,

    }
}
